
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>重置密码</title>
    <#--<%@include file="/WEB-INF/views/common/link.jsp" %>-->
    <#include "../common/link.ftl">

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#--<%@include file="/WEB-INF/views/common/navbar.jsp" %>-->
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <#--<c:set var="currentMenu" value="employee"/>-->
        <#assign currentMenu="employee"/>
    <#--<%@include file="/WEB-INF/views/common/menu.jsp" %>-->
        <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>重置密码</h1>
        </section>
        <section class="content">
            <div class="box" style="padding: 30px;" >
                <!--高级查询--->
                <form class="form-horizontal" action="/employee/resetPwd.do" method="post" id="editForm" >
                    <input type="hidden"  name="id">
                    <div class="form-group" style="text-align: center;">
                       <h3>您正在重置员工${employee.name}的密码</h3>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <label for="sn"   class="col-sm-3 control-label">新密码：</label>
                        <div class="col-sm-6">
                            <input type="password" id="newPassword" class="form-control"  name="newPassword"
                                   placeholder="请输入新密码">
                        </div>
                    </div>
                    <#--这里是为了拿到员工的姓名,在后续重置密码时候当做Sql语句的条件-->
                    <input type="hidden" id="userId" value="${employee.id}" class="form-control"  name="userId"/>
                    <input type="hidden" id="name" value="${employee.name}" class="form-control"  name="name"/>


                    <script>
                        $(function () {
                            $('#submitBtn').click(function () {
                                var newPassword = $('#newPassword').val();
                                var name = $('#name').val();
                                var userId = $('#userId').val();
                                console.log(newPassword);
                                console.log(userId);
                                var id = $('#id').val();
                                $.post('/resetPassword.do',{newPassword:newPassword,userId:userId,name:name},function (data) {
                                    if(data.success){
                                        alert("重置成功")
                                        window.location.href = "/employee/list.do";
                                    }else{
                                        alert("重置失败")
                                    }
                                })
                            })
                        })
                    </script>
                    <div class="form-group">
                        <div class="col-sm-offset-3 col-sm-6">
                            <button id="submitBtn" type="button" class="btn btn-primary">确定重置</button>
                        </div>
                    </div>
                </form>

            </div>
        </section>
    </div>
    <#--<%@include file="/WEB-INF/views/common/footer.jsp" %>-->
    <#include "../common/footer.ftl">
</div>
</body>
</html>
